package com.doit.day01;

import org.apache.commons.lang3.RandomUtils;
import redis.clients.jedis.Jedis;

import java.util.UUID;

public class ProducerDemo {
    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = new Jedis("linux01", 6379);
        //生产task
        System.out.println("年薪百万的程序员们开始生产有bug的代码了.......");
        while (true){
            //造task任务
            UUID uuid = UUID.randomUUID();
            jedis.lpush("producer",uuid.toString());
            Thread.sleep(RandomUtils.nextInt(1000,2000));
            if (jedis.llen("producer") >=10){
                Thread.sleep(5000);
            }
        }




    }
}
